import type { App, Plugin } from 'vue'
// import { h } from 'vue';
// 全局组件
import {
  Button,
  Toast,
  Icon,
  Layout,
  Row,
  Col,
  Cell,
  CellGroup,
  Avatar,
  Checkbox,
  Switch,
  Input,
  TextArea,
  Popup,
  Elevator,
  Tag,
  Dialog,
  Price,
  // SearchBar,
} from '@nutui/nutui-taro'

import Skeleton from '@/components/Skeleton/Skeleton.vue'
import SkeletonItem from '@/components/Skeleton/SkeletonItem.vue'

// // 全局指令
// import loading from '@/components/Loading/loading-directive.js'

const globalRegister: Plugin = {
  install: (app: App) => {
    app
      .use(Button)
      .use(Toast)
      .use(Icon)
      .use(Layout)
      .use(Row)
      .use(Col)
      .use(Cell)
      .use(CellGroup)
      .use(Avatar)
      .use(Checkbox)
      .use(Switch)
      .use(Input)
      .use(TextArea)
      .use(Popup)
      .use(Elevator)
      .use(Tag)
      .use(Dialog)
      .use(Price)
      // .use(SearchBar)

      // 自定义的全局组件
      .component('v-skeleton', Skeleton)
      .component('v-skeleton-item', SkeletonItem)

    // 解决 nut-address 警告
    // .component('view-block', {
    //   render() {
    //     return h('view', this);
    //   },
    // });
  },
}

export default globalRegister
